/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package validaciones;

/**
 *
 * @author David Vallejos A
 */
public class conversorCodigosBD {

    int cod_registro = 0;
    int cod_animal = 0;
    int cod_raza = 0;
    int cod_des_animal = 0;
    int cod_boleta = 0;
    int cod_tratamiento = 0;
    int cod_medicamento = 0;
    int cod_consulta = 0;

    public void crearCodRegistro(String rut) {

        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_registro = ((rutNro % 1000000) - 323);
    }

    public void crearCodAnimal(String rut) {

        int numeroAleatorio = (int) (Math.random() * 100 + 1);
        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_animal = ((rutNro % 1000000) - numeroAleatorio);
    }

    public void crearCodRaza(String rut) {

        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_raza = ((rutNro % 1000000) - 767);
    }

    public void crearCodDesAnimal(String rut) {

        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_des_animal = ((rutNro % 1000000) - 848);
    }

    public void crearCodBoleta(String rut) {

        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_boleta = ((rutNro % 1000000) - 482);
    }

    public void crearCodTratamiento(String rut) {

        int numeroAleatorio = (int) (Math.random() * 100 + 1);
        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_tratamiento = ((rutNro % 10000) - numeroAleatorio);
    }

    public void crearCodMedicamento(String rut) {

        int numeroAleatorio = (int) (Math.random() * 100 + 1);
        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_medicamento = ((rutNro % 1000000) - numeroAleatorio);
    }

    public void crearCod_consulta(String rut) {

        int length = rut.length();
        int rutNro = Integer.parseInt(rut.replace(".", "").replace("-", "").replace("k", "0"));
        cod_consulta = ((rutNro % 1000000) - 184);

    }

    public int getCod_animal() {
        return cod_animal;
    }

    public int getCod_boleta() {
        return cod_boleta;
    }

    public int getCod_des_animal() {
        return cod_des_animal;
    }

    public int getCod_medicamento() {
        return cod_medicamento;
    }

    public int getCod_raza() {
        return cod_raza;
    }

    public int getCod_registro() {
        return cod_registro;
    }

    public int getCod_tratamiento() {
        return cod_tratamiento;
    }

    public int getCod_consulta() {
        return cod_consulta;
    }
}
